package com.qzsoft.system.modules.permission.group.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qzsoft.system.modules.permission.group.dto.SysGroupDTO;
import com.qzsoft.system.modules.permission.group.entity.SysUserGroupEntity;
import com.qzsoft.system.modules.permission.roleclass.dto.SysRoleClassTreeDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户与用户组关联关系(SysUserGroup)表数据库访问层
 *
 * @author zt
 * @since 2020-09-22 14:24:44
 */
@Mapper
@Repository
public interface SysUserGroupDao extends BaseMapper<SysUserGroupEntity> {
    @Select("SELECT sug.group_id as id,sg.name FROM sys_user_group sug inner join sys_group sg on sug.group_id=sg.id and sug.has_delete='0' and sug.user_id=#{id}")
    List<SysGroupDTO> getGroupList(Long id);
    @Select("select sr.id,sr.name from  sys_role sr where id=#{roleid}")
    SysRoleClassTreeDTO selectRoleById(Long roleid);
}